const {baseController} = require('../../baseController')
const serviceEnter = require('../../../service/serviceEnter')
const {result} = require('../../../util/result/result')
const beansEnter = require('../../../beans/beansEnter')

class professionController extends  baseController{

    static sigleIns = new professionController()

    static getSigleIns =()=>{
        if(this.sigleIns){
            return this.sigleIns
        }else{
            return new professionController()
        }
    }


   
    constructor(){
        super(serviceEnter.professionService.getIns())
        this.service = serviceEnter.professionService.getIns()
        this.kemuZhiyeService =serviceEnter.kemuZhiyeService.getIns()
    }

    async create(req,res){
      
        let data 
        try {
            data =  await  this.service.create(req.body)
        } catch (error) {
            console.log(error);
            return
        }
        if(data==undefined){
            res.send(result(false))
        }else{
            res.send(result(true,data))
        }
    }
    



    async queryAll(req,res){
        let data  
        try {
            data =  await  this.service.queryAll('direction_id','kemuIDArray')
        } catch (error) {
                console.log(error)
            return 
        }
        if(data&&data!=undefined){
            res.send(result(true,data))
         }else{
            res.send(result(false))
         }
    }




}

module.exports={
    professionController
}